import { createApp } from 'vue'
import App from './App.vue'
import "@/style/index.scss"
import '@/theme/index.scss';

import 'virtual:svg-icons-register'

import horizontalScroll from 'el-table-horizontal-scroll'
 

import components from '@/components/index';
//pinia
import { createPinia } from 'pinia'

import piniaPluginPersistedstate from 'pinia-plugin-persistedstate'
import VueResizeObserver from "vue-resize-observer";

//routes
import router from "./router/index";
import objCopy from './utils/objCopy';
import resetForm from './utils/resetForm'
import myconfirm from './utils/myconfirm'
import { dragTable } from '@/directives/tableMove'

import ElementPlus from 'element-plus'
import 'element-plus/dist/index.css'
import zhCn from 'element-plus/dist/locale/zh-cn.mjs'


import * as ElementPlusIconsVue from '@element-plus/icons-vue'
import directive from "@/directives/index";
import "@/utils/routerPerssion"



const pinia = createPinia()
pinia.use(piniaPluginPersistedstate)
const app = createApp(App)

app.use(router).use(pinia).use(ElementPlus, {
  locale: zhCn,
}).use(VueResizeObserver).use(directive).use(horizontalScroll).mount('#app')



export type Form = InstanceType<typeof Form>;

app.config.globalProperties.$objCopy = objCopy
app.config.globalProperties.$resetForm = resetForm
app.config.globalProperties.$myconfirm = myconfirm
app.config.globalProperties.$dragTable = dragTable

// 如果您正在使用CDN引入，请删除下面一行。
for (const [key, component] of Object.entries(ElementPlusIconsVue)) {
  app.component(key, component)
}

Object.keys(components).forEach((name) => {
  // @ts-ignore
  app.component(name, components[name])
})
